package com.retrozelda.nyanimals;

import android.content.Context;
import android.opengl.GLSurfaceView;
import android.view.MotionEvent;

class NyanimalGLSurfaceView extends GLSurfaceView
{

	CNyanimalGLRender	m_renderer;

	public NyanimalGLSurfaceView(Context context)
	{
		super(context);
		setEGLContextClientVersion(2); // enable OpenGL ES 2.0

		m_renderer = new CNyanimalGLRender();
		m_renderer.SetSurface(this);

		setRenderer(m_renderer);
	}

	@Override
	public boolean onTouchEvent(MotionEvent event)
	{
		boolean touchResult = m_renderer.HandleTouchEvent(event);
		
		// if false, we know to exit
		if(touchResult == false)
		{
			CGameActivity game = (CGameActivity)getContext();
			game.finish();
		}
		
		return touchResult;
	}

}
